import {hopeTheme} from "vuepress-theme-hope";
import {enNavbar, zhNavbar} from "./navbar/index.js";
import {enSidebar, zhSidebar} from "./sidebar/index.js";
import { mdEnhancePlugin } from "vuepress-plugin-md-enhance";

const hostname =
    process.env["HOSTNAME"] || "https://theme-hope-docs-demo.vuejs.press";

export default hopeTheme(
    {
        hostname,
        fullscreen: true,
        author: {
            name: "pucong",
            url: "https://gitee.com/pucong",
        },

        iconAssets: "fontawesome-with-brands",

        favicon: "/logo2.png",
        logo: "/logo2.png",

        repo: "https://gitee.com/pucong/auto-api-desc",
        editLink: true,
        repoLabel:"点击编辑",
        docsRepo:"https://gitee.com/pucong/auto-api-desc",
        docsBranch:"master",
        docsDir: "docs",
        locales: {
            /**
             * Chinese locale config
             */
            "/": {
                // navbar
                navbar: zhNavbar,

                // sidebar
                sidebar: zhSidebar,

                footer: "GPL-2.0 协议 | Copyright © 2020-present pucong",

                displayFooter: true,

                // page meta
                metaLocales: {
                    editLink: "帮助完善此页",
                },
            },

            "/en/": {
                // navbar
                navbar: enNavbar,

                // sidebar
                sidebar: enSidebar,

                footer: "GPL-2.0 LICENSE | Copyright © 2020-present pucong",

                displayFooter: true,

                metaLocales: {
                    editLink: "Help improve this page",
                },
            },

        },
        plugins: {
            copyCode:{
                showInMobile :true
            },
            // All features are enabled for demo, only preserve features you need here
            mdEnhance: {
                alert : true,
                align: true,
                attrs: true,
                chart: true,
                codetabs: true,
                demo: true,
                echarts: true,
                figure: true,
                flowchart: true,
                gfm: true,
                imgLazyload: true,
                imgSize: true,
                include: true,
                katex: true,
                mark: true,
                mermaid: true,
                playground: {
                    presets: ["ts", "vue", "unocss"],
                },
                presentation: {
                    plugins: ["highlight", "math", "search", "notes", "zoom"],
                },
                // 启用幻灯片
                revealJs: {
                    plugins: ["highlight", "math", "search", "notes", "zoom"],
                    themes: [
                        "auto",
                        "beige",
                        "black",
                        "blood",
                        "league",
                        "moon",
                        "night",
                        "serif",
                        "simple",
                        "sky",
                        "solarized",
                        "white",
                    ],
                },
                stylize: [
                    {
                        matcher: "Recommended",
                        replacer: ({ tag }) => {
                            if (tag === "em")
                                return {
                                    tag: "Badge",
                                    attrs: { type: "tip" },
                                    content: "Recommended",
                                };
                        },
                    },
                ],
                sub: true,
                sup: true,
                tabs: true,
                vPre: true,
                vuePlayground: true,
            },

            pwa: {
                favicon: "/favicon.ico",
                cacheHTML: true,
                cachePic: true,
                appendBase: true,
                apple: {
                    icon: "/assets/icon/apple-icon-152.png",
                    statusBarColor: "black",
                },
                msTile: {
                    image: "/assets/icon/ms-icon-144.png",
                    color: "#ffffff",
                },
                manifest: {
                    icons: [
                        {
                            src: "/assets/icon/chrome-mask-512.png",
                            sizes: "512x512",
                            purpose: "maskable",
                            type: "image/png",
                        },
                        {
                            src: "/assets/icon/chrome-mask-192.png",
                            sizes: "192x192",
                            purpose: "maskable",
                            type: "image/png",
                        },
                        {
                            src: "/assets/icon/chrome-512.png",
                            sizes: "512x512",
                            type: "image/png",
                        },
                        {
                            src: "/assets/icon/chrome-192.png",
                            sizes: "192x192",
                            type: "image/png",
                        },
                    ],
                    shortcuts: [
                        {
                            name: "Demo",
                            short_name: "Demo",
                            url: "/demo/",
                            icons: [
                                {
                                    src: "/assets/icon/guide-maskable.png",
                                    sizes: "192x192",
                                    purpose: "maskable",
                                    type: "image/png",
                                },
                            ],
                        },
                    ],
                },
            },

            seo:
                hostname === "https://theme-hope-docs-demo.vuejs.press"
                    ? {}
                    : {canonical: "https://theme-hope-docs-demo.vuejs.press"},
        },
    },
    {custom: true}
);
